package com.weilai.dao;

import com.weilai.domain.ReportInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ReportInfoDao {

    //查询所有待处理举报信息
    @Select("SELECT * FROM report_info WHERE status='待处理'")
    public List<ReportInfo> selectReportedInfo();
    //查询单个
    @Select("SELECT * FROM report_info WHERE id=#{id}")
    public ReportInfo selectReportedInfoById();
    //查询所有举报信息
    @Select("SELECT * FROM report_info")
    public List<ReportInfo> selectAllReportedInfo();
    //用户举报
    @Insert("INSERT INTO report_Info (post_id,reporter_id,report_type,report_reason) values (#{postId},#{reporterId},#{reportType},#{reportReason})")
    public void reportOthers(ReportInfo reportInfo);
    //处理举报
    @Update({"update report_info set status='已处理' where id=#{id}"})
    public void reportSuccessfully (int id);
    @Update({"update posts set status='未通过' where id=#{id}"})
    public void updateReportSuccessfully(int id);
    //举报失败
    @Update({"update report_info set status='已处理' where id=#{id}"})
    public void reportFail (int id);




}
